home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / lib / partman / automatically_partition / 50biggest_free / choices next >
Encoding:
Text File  |  2009-04-19  |  857 b   |  49 lines

  1. #!/bin/sh
  2.  
  3. . /lib/partman/lib/base.sh
  4.  
  5. mypart=''
  6. mysize=0
  7.  
  8. disks=
  9. if db_get partman-auto/disk; then
  10.     disks="$RET"
  11. fi
  12.  
  13. for dev in $DEVICES/*; do
  14.     [ -d $dev ] || continue
  15.     if [ "$disks" ]; then
  16.         partman_disk="$(cat "$dev/device")"
  17.         local found=0
  18.         for preseed_disk in $disks; do
  19.             preseed_id=$(mapdevfs $preseed_disk)
  20.             case " $preseed_id " in
  21.                 *" $partman_disk "*)
  22.                 found=1
  23.                 ;;
  24.                 *)
  25.                 continue
  26.                 ;;
  27.             esac
  28.         done
  29.         if [ "$found" = "0" ]; then
  30.             continue
  31.         fi
  32.     fi
  33.     cd $dev
  34.     open_dialog PARTITIONS
  35.     while { read_line num id size type fs path name; [ "$id" ]; }; do
  36.         if [ "$fs" = free ] && [ "$type" != unusable ] && \
  37.            ! longint_le $size $mysize; then
  38.             mysize=$size
  39.             mypart=$dev//$id
  40.         fi
  41.     done
  42.     close_dialog
  43. done
  44.  
  45. if [ "$mypart" ]; then
  46.     db_metaget partman-auto/text/use_biggest_free description
  47.     printf "$mypart\t$RET"
  48. fi
  49.